{template 'common/header'}
<style>
.field label{float:left;margin:0 !important; width:140px;}
</style>
<div class="main">
	<ul class="nav nav-tabs">
		<li><a href="{php echo $this->createWebUrl('list');}">防伪码列表</a></li>
		<li><a href="{php echo $this->createWebUrl('create');}">生成防伪码</a></li>
		<li class="active"><a href="{php echo $this->createWebUrl('insert');}">数据导入</a></li>
		<li><a href="{php echo $this->createWebUrl('logs');}">查询记录</a></li>
	</ul>
	<div class="panel panel-info">
		<div class="panel-heading">批量导入防伪码</div>
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form" enctype="multipart/form-data" id="form1">
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-1 control-label">上传文件</label>
				<div class="col-sm-4">
					<input class="form-control" type="file" name="file" />&nbsp;&nbsp;目前支持EXCEL或TXT 一行一个防伪码 
				</div>		
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-1 control-label">产品名称</label>
				<div class="col-sm-4">
					<input class="form-control" name="sName" id="" type="text" value="">
				</div>
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-1 control-label">生产厂家</label>
				<div class="col-sm-4">
					<input class="form-control" name="sFactory" id="" type="text" value="">
				</div>
					
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-1 control-label">积分类型</label>
				<div class="col-sm-4">
					<input class="form-control" name="creditname" id="" type="text" value="">
				</div>
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-1 control-label">积分值</label>
				<div class="col-sm-4">
					<input class="form-control" name="creditnum" id="" type="text" value="">
				</div>
					
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-1 control-label">积分状态</label>
				<div class="col-sm-4">
					<input name="creditstatus" id="" type="radio" value="0" checked> 未发放
					<input name="creditstatus" id="" type="radio" value="1"> 已发放
				</div>
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-1 control-label">有效日期</label>
				<div class="col-sm-4">
					{php echo tpl_form_field_date('sTime', $value = array(), $withtime = true );}
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-8">
					<input type="submit" name="submit" value="导入防伪码" class="btn btn-primary">
					<input type="hidden" name="token" value="{$_W['token']}" />
				</div>		
			</div>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
	require(['jquery', 'util'], function($, u){
		$("#form1").submit(function(){
			if(!$(":file[name='file']").val()) {
				u.message('抱歉，文件还没上传哦，请返回修改！', '', 'error');
				return false;
			}
			if($(":text[name='sName']").val() == '') {
				u.message('抱歉，产品名称为必填项，请返回修改！', '', 'error');
				return false;
			}
			if($(":text[name='sFactory']").val() == '') {
				u.message('抱歉，生成厂家为必填项，请返回修改！', '', 'error');
				return false;
			}
			if($(":text[name='creditname']").val() == '') {
				u.message('抱歉，积分类型为必填项，请返回修改！', '', 'error');
				return false;
			}
			if($(":text[name='creditnum']").val() == '') {
				u.message('抱歉，积分数为必填项，请返回修改！', '', 'error');
				return false;
			}
			return true;
		});
	});
</script>
{template 'common/footer'}